import App from "./App";

// #ifndef VUE3
import Vue from "vue";
import { router, RouterMount } from "@/router";
import store from "@/store";
import i18n from "@/locale";
import utils from "@/lib/utils";
import uView from "@/uni_modules/uview-ui";
import mixin from "@/config/global.mixin";
import "@/lib/z-paging-config";
import "./uni.promisify.adaptor";
import VEmpty from "@/components/VEmpty.vue";
import FooterNav from "@/components/footer-nav/footer-nav.vue";
import Toptab from "@/components/toptab/toptab.vue";

Vue.component("VEmpty", VEmpty);
Vue.component("FooterNav", FooterNav);
Vue.component("Toptab", Toptab);
Vue.use(utils);
Vue.use(uView);
Vue.use(router);

Vue.mixin(mixin);

Vue.config.productionTip = false;
App.mpType = "app";
const app = new Vue({
  store,
  i18n,
  ...App,
});
// H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
RouterMount(app, router, "#app");
// #endif

// #ifndef H5
app.$mount(); // 为了兼容小程序及app端必须这样写才有效果
// #endif

// #endif

// 引入请求封装，将app参数传递到配置中
require("@/config/request.js")(app);

// #ifdef VUE3
import { createSSRApp } from "vue";
export function createApp() {
  const app = createSSRApp(App);
  return {
    app,
  };
}
// #endif
